package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class UserIntegralRecordListRequest extends Request {

	private static final long serialVersionUID = -1151306028731417000L;

	/**
	 * 用户id
	 */
	private Integer userId;
	//expandCode 渠道
	private String expandCode ;
	public String getExpandCode() {
		return expandCode;
	}

	public void setExpandCode(String expandCode) {
		this.expandCode = expandCode;
	}

	public Integer getApplicablePlatformId() {
		return applicablePlatformId;
	}

	public void setApplicablePlatformId(Integer applicablePlatformId) {
		this.applicablePlatformId = applicablePlatformId;
	}

	//applicablePlatformId,平台
	private Integer applicablePlatformId;
	
	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	//当前页码 
	private int pageNum = 1;
	//每页条数 
	private int numPerPage = 20;
	
	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getNumPerPage() {
		return numPerPage;
	}

	public void setNumPerPage(int numPerPage) {
		this.numPerPage = numPerPage;
	}
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
//		this.expandCode = requestInfo.getParameter(ApiUrlParamEnum.expandCode.getParamName(), ExpandCodeEnum.MALL.getId());
//		this.applicablePlatformId = requestInfo.getIntParameter(ApiUrlParamEnum.applicablePlatformId.getParamName(), ApplicablePlatformEnum.WEB.getId());
		this.pageNum = requestInfo.getIntParameter(ApiUrlParamEnum.pageNo.getParamName(), 1);
		this.numPerPage = requestInfo.getIntParameter(ApiUrlParamEnum.pageSize.getParamName(), 20);
		if (userId < 1) {
			throw new RequestIllegalException("error userId: " + userId);
		}
	}
}
